Skip to content

feat(bigtable): Add support for adding tags to an Instance in InstanceConfig#16014

Merged
scotthart merged 4 commits into
googleapis:mainfrom
dohun-dev:tags
Jun 24, 2026
Merged

feat(bigtable): Add support for adding tags to an Instance in InstanceConfig#16014
scotthart merged 4 commits into
googleapis:mainfrom
dohun-dev:tags

Conversation

@dohun-dev

Copy link
Copy Markdown
Contributor

No description provided.

@dohun-dev dohun-dev requested a review from a team as a code owner March 2, 2026 12:59
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Mar 2, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the InstanceConfig class by providing new methods to associate tags with Bigtable instances. This functionality allows for better organization and management of instances through metadata, ensuring that instances can be properly categorized and identified using key-value pairs.

Highlights

  • New Tagging Functionality: Introduced insert_tag and emplace_tag methods to the InstanceConfig class, allowing users to add key-value tags to a Bigtable Instance.
  • Test Coverage: Added a new unit test, SetTags, to instance_config_test.cc to verify the correct behavior of the new tagging methods.
Changelog
  • google/cloud/bigtable/instance_config.h
    • Added insert_tag method to add a tag with a constant string reference key and value.
    • Added emplace_tag method to add a tag with a constant string reference key and a moved string value.
  • google/cloud/bigtable/instance_config_test.cc
    • Added SetTags test case to validate the functionality of adding tags to an InstanceConfig.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for setting tags on an InstanceConfig, which is a useful feature. The implementation is straightforward, adding insert_tag and emplace_tag methods that are consistent with the existing insert_label and emplace_label methods. The new functionality is also well-tested. I have one suggestion to improve the efficiency of emplace_tag by adding an overload for rvalue keys.

Comment on lines +75 to +78
InstanceConfig& emplace_tag(std::string const& key, std::string value) {
(*proto_.mutable_instance()->mutable_tags())[key] = std::move(value);
return *this;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To optimize for cases where the key is an rvalue (e.g., a temporary from a string literal), consider adding an overload for emplace_tag that accepts an rvalue reference for the key. This allows moving the key into the map instead of copying it, improving efficiency.

A similar improvement could be made to emplace_label in a follow-up change for consistency.

  InstanceConfig& emplace_tag(std::string const& key, std::string value) {
    (*proto_.mutable_instance()->mutable_tags())[key] = std::move(value);
    return *this;
  }

  InstanceConfig& emplace_tag(std::string&& key, std::string value) {
    (*proto_.mutable_instance()->mutable_tags())[std::move(key)] =
        std::move(value);
    return *this;
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@scotthart

Copy link
Copy Markdown
Member

/gcbrun

@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.24%. Comparing base (6b42af6) to head (5a441a5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16014   +/-   ##
=======================================
  Coverage   92.24%   92.24%           
=======================================
  Files        2265     2265           
  Lines      210107   210126   +19     
=======================================
+ Hits       193803   193828   +25     
+ Misses      16304    16298    -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@scotthart

Copy link
Copy Markdown
Member

/gcbrun

@scotthart

Copy link
Copy Markdown
Member

/gcbrun

@scotthart

Copy link
Copy Markdown
Member

/gcbrun

return *this;
}

InstanceConfig& emplace_tag(std::string&& key, std::string value) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this overload? I know this is probably added because of the code assist, but looking at insert_label and emplace_label, it only has std::string const& key version. maybe we should just mirror that first.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to leave it. The *_label functions could be similarly improved.

@scotthart

Copy link
Copy Markdown
Member

Running $ ci/cloudbuild/build.sh -t checkers-pr locally should resolve the formatting issues causing the checkers-pr and generate-libraries-pr failures.

@dohun-dev

Copy link
Copy Markdown
Contributor Author

Running $ ci/cloudbuild/build.sh -t checkers-pr locally should resolve the formatting issues causing the checkers-pr and generate-libraries-pr failures.

Got it, I ran this and repushed the fixes in.

@scotthart

Copy link
Copy Markdown
Member

/gcbrun

@scotthart scotthart merged commit 0a8f509 into googleapis:main Jun 24, 2026
61 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants